<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:insert="~{include :: header('登录日志列表')}" />
	<th:block th:insert="~{include :: bootstrap-table-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
	<div class="toolbar" id="toolbar" role="group">
		<form id="formId">
			<div class="form-inline">
				<a class="btn btn-danger mr-1" onclick="$.operate.clean()" shiro:hasPermission="monitor:logininfor:remove">
					<i class="fa fa-trash"></i> 清空
				</a>
				<input type="text" class="form-control mr-1" name="ipAddr" placeholder="登录地址"/>
				<input type="text" class="form-control mr-1" name="loginName" placeholder="登录名称"/>
				<button type="button" class="btn btn-primary mr-1" onclick="$.table.search()">
					<i class="fa fa-search"></i>
					搜索
				</button>
				<button type="button" class="btn btn-default" onclick="$.form.reset()">
					<i class="fa fa-refresh"></i>
					重置
				</button>
			</div>
		</form>
	</div>
	<table id="bootstrap-table" class="table-striped"></table>
</div>

<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: bootstrap-table-js}" />
<script th:inline="javascript">
	var datas = [[${@dict.getType('sys_common_status')}]];
	var prefix = "/manager/login";

	$(function() {
		var options = {
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			url: prefix + "/list.json",
			cleanUrl: prefix + "/clean.json",
			removeUrl: prefix + "/remove.json",
			sortName: "loginTime",
			sortOrder: "desc",
			modalName: "登录日志",
			escape: true,
			showPageGo: true,
			rememberSelected: true,
			columns: [{
				field: 'id',
				title: 'id',
			},
				{
					field: 'loginName',
					title: '登录名称',
					sortable: true
				},
				{
					field: 'ipAddr',
					title: '登录地址'
				},
				{
					field: 'loginLocation',
					title: '登录地点'
				},
				{
					field: 'browser',
					title: '浏览器'
				},
				{
					field: 'os',
					title: '操作系统'
				},
				{
					field: 'status',
					title: '登录状态',
					align: 'center',
					formatter: function(value, row, index) {
						return $.table.selectDictLabel(datas, value);
					}
				},
				{
					field: 'msg',
					title: '操作信息'
				},
				{
					field: 'loginTime',
					title: '登录时间',
					sortable: true
				}]
		};
		$.table.init(options);
	});

	function unlock() {
		$.operate.post(prefix + "/unlock.json?loginName=" + $.table.selectColumns("loginName"));
	}
</script>
</body>
</html>